

#import "ALCameraCell.h"
@interface ALCameraCell()
@property (nonatomic, strong) ALAsset *asset;
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, copy) NSString *type;
@end
@implementation ALCameraCell
- (id)initWithFrame:(CGRect)frame
{
	self = [super initWithFrame:frame];
	if (self)
	{
		self.imageView=[[UIImageView alloc] init];
		[self addSubview:self.imageView];
	}
	return self;
}
- (void)layoutSubviews{
	[super layoutSubviews];
	if (self.imageView.frame.size.width==84/2) {
		[self.imageView setFrame:CGRectMake((self.frame.size.width-84/2)/2, (self.frame.size.height-67/2)/2, 84/2, 67/2)];
	}else{
	[self.imageView setFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
	}
}
- (void)applyData:(ALAsset *)asset
{
	if (!asset) {
		[self.imageView setFrame:CGRectMake((self.frame.size.width-84/2)/2, (self.frame.size.height-67/2)/2, 84/2, 67/2)];
		[self setBackgroundColor:[UIColor grayColor]];
		self.imageView.image=[UIImage imageNamed:@"CameraPicker.bundle/Camera"];
	}else{
		[self.imageView setBackgroundColor:[UIColor clearColor]];
		self.asset  = asset;
		self.imageView.image=[UIImage imageWithCGImage:asset.thumbnail];
		self.type   = [asset valueForProperty:ALAssetPropertyType];
	}
}
@end
